home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15016 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  1.8 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news text default
99% file C++ source, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 62 6c | 75 65 2e 75 73 70 73 2e |Path: bl|ue.usps.|
|00000010| 67 6f 76 21 62 65 6e 6e | 65 74 62 72 40 66 63 73 |gov!benn|etbr@fcs|
|00000020| 63 2e 75 73 70 73 2e 67 | 6f 76 0a 46 72 6f 6d 3a |c.usps.g|ov.From:|
|00000030| 20 42 69 6c 6c 20 53 65 | 79 6d 6f 75 72 20 3c 77 | Bill Se|ymour <w|
|00000040| 73 65 79 6d 6f 75 72 40 | 65 6d 61 69 6c 2e 75 73 |seymour@|email.us|
|00000050| 70 73 2e 67 6f 76 3e 0a | 4e 65 77 73 67 72 6f 75 |ps.gov>.|Newsgrou|
|00000060| 70 73 3a 20 63 6f 6d 70 | 2e 6c 61 6e 67 2e 63 2b |ps: comp|.lang.c+|
|00000070| 2b 0a 53 75 62 6a 65 63 | 74 3a 20 54 65 6d 70 6c |+.Subjec|t: Templ|
|00000080| 61 74 65 73 2c 20 50 6f | 69 6e 74 65 72 73 20 74 |ates, Po|inters t|
|00000090| 6f 20 4d 65 6d 62 65 72 | 73 20 61 6e 64 20 53 74 |o Member|s and St|
|000000a0| 61 74 69 63 20 49 6e 69 | 74 69 61 6c 69 7a 61 74 |atic Ini|tializat|
|000000b0| 69 6f 6e 0a 44 61 74 65 | 3a 20 31 20 41 70 72 20 |ion.Date|: 1 Apr |
|000000c0| 31 39 39 36 20 31 36 3a | 33 30 3a 33 37 20 47 4d |1996 16:|30:37 GM|
|000000d0| 54 0a 4f 72 67 61 6e 69 | 7a 61 74 69 6f 6e 3a 20 |T.Organi|zation: |
|000000e0| 55 2e 20 53 2e 20 50 6f | 73 74 61 6c 20 53 65 72 |U. S. Po|stal Ser|
|000000f0| 76 69 63 65 0a 4d 65 73 | 73 61 67 65 2d 49 44 3a |vice.Mes|sage-ID:|
|00000100| 20 3c 34 6a 70 30 62 64 | 24 32 68 37 40 62 6c 75 | <4jp0bd|$2h7@blu|
|00000110| 65 2e 75 73 70 73 2e 67 | 6f 76 3e 0a 4e 4e 54 50 |e.usps.g|ov>.NNTP|
|00000120| 2d 50 6f 73 74 69 6e 67 | 2d 48 6f 73 74 3a 20 73 |-Posting|-Host: s|
|00000130| 65 79 6d 6f 75 77 61 2e | 75 73 70 73 2e 67 6f 76 |eymouwa.|usps.gov|
|00000140| 0a 4d 69 6d 65 2d 56 65 | 72 73 69 6f 6e 3a 20 31 |.Mime-Ve|rsion: 1|
|00000150| 2e 30 0a 43 6f 6e 74 65 | 6e 74 2d 54 79 70 65 3a |.0.Conte|nt-Type:|
|00000160| 20 74 65 78 74 2f 70 6c | 61 69 6e 3b 20 63 68 61 | text/pl|ain; cha|
|00000170| 72 73 65 74 3d 75 73 2d | 61 73 63 69 69 0a 43 6f |rset=us-|ascii.Co|
|00000180| 6e 74 65 6e 74 2d 54 72 | 61 6e 73 66 65 72 2d 45 |ntent-Tr|ansfer-E|
|00000190| 6e 63 6f 64 69 6e 67 3a | 20 37 62 69 74 0a 58 2d |ncoding:| 7bit.X-|
|000001a0| 4d 61 69 6c 65 72 3a 20 | 4d 6f 7a 69 6c 6c 61 20 |Mailer: |Mozilla |
|000001b0| 31 2e 31 20 28 57 69 6e | 64 6f 77 73 3b 20 55 3b |1.1 (Win|dows; U;|
|000001c0| 20 31 36 62 69 74 29 0a | 54 6f 3a 20 77 73 65 79 | 16bit).|To: wsey|
|000001d0| 6d 6f 75 72 40 65 6d 61 | 69 6c 2e 75 73 70 73 2e |mour@ema|il.usps.|
|000001e0| 67 6f 76 0a 0a 49 20 6e | 65 65 64 20 74 6f 20 63 |gov..I n|eed to c|
|000001f0| 72 65 61 74 65 20 61 20 | 73 74 61 74 69 63 20 63 |reate a |static c|
|00000200| 6f 6e 73 74 20 61 73 73 | 6f 63 69 61 74 69 76 65 |onst ass|ociative|
|00000210| 20 61 72 72 61 79 20 6f | 66 20 64 65 73 63 72 69 | array o|f descri|
|00000220| 70 74 6f 72 73 20 66 6f | 72 0a 6d 65 6d 62 65 72 |ptors fo|r.member|
|00000230| 73 20 6f 66 20 61 72 62 | 69 74 72 61 72 79 20 73 |s of arb|itrary s|
|00000240| 74 72 75 63 74 75 72 65 | 73 2e 20 20 49 74 27 73 |tructure|s. It's|
|00000250| 20 6b 6e 6f 77 6e 20 74 | 68 61 74 20 61 6c 6c 20 | known t|hat all |
|00000260| 6d 65 6d 62 65 72 73 20 | 77 69 6c 6c 20 68 61 76 |members |will hav|
|00000270| 65 0a 74 79 70 65 20 63 | 68 61 72 5b 5d 20 61 6e |e.type c|har[] an|
|00000280| 64 20 63 6f 6e 74 61 69 | 6e 20 6e 75 6c 6c 2d 74 |d contai|n null-t|
|00000290| 65 72 6d 69 6e 61 74 65 | 64 20 73 74 72 69 6e 67 |erminate|d string|
|000002a0| 73 2e 20 20 4d 79 20 66 | 69 72 73 74 20 69 64 65 |s. My f|irst ide|
|000002b0| 61 20 66 6f 72 20 6f 6e | 65 0a 65 6c 65 6d 65 6e |a for on|e.elemen|
|000002c0| 74 20 6f 66 20 73 75 63 | 68 20 61 6e 20 61 72 72 |t of suc|h an arr|
|000002d0| 61 79 20 69 73 3a 0a 0a | 20 20 20 20 73 74 72 75 |ay is:..| stru|
|000002e0| 63 74 20 4d 65 6d 62 65 | 72 44 65 73 63 72 69 70 |ct Membe|rDescrip|
|000002f0| 74 6f 72 0a 20 20 20 20 | 7b 0a 20 20 20 20 20 20 |tor. |{. |
|00000300| 20 20 63 6f 6e 73 74 20 | 63 68 61 72 2a 20 6e 61 | const |char* na|
|00000310| 6d 65 3b 0a 20 20 20 20 | 20 20 20 20 70 74 72 64 |me;. | ptrd|
|00000320| 69 66 66 5f 74 20 6f 66 | 66 73 65 74 3b 0a 20 20 |iff_t of|fset;. |
|00000330| 20 20 20 20 20 20 73 69 | 7a 65 5f 74 20 73 69 7a | si|ze_t siz|
|00000340| 65 3b 0a 20 20 20 20 20 | 20 20 20 63 68 61 72 2a |e;. | char*|
|00000350| 20 47 65 74 53 74 72 69 | 6e 67 28 76 6f 69 64 2a | GetStri|ng(void*|
|00000360| 20 73 74 72 29 20 63 6f | 6e 73 74 20 7b 20 72 65 | str) co|nst { re|
|00000370| 74 75 72 6e 20 28 63 68 | 61 72 2a 29 73 74 72 20 |turn (ch|ar*)str |
|00000380| 2b 20 6f 66 66 73 65 74 | 3b 20 7d 0a 20 20 20 20 |+ offset|; }. |
|00000390| 7d 3b 0a 0a 62 75 74 20 | 6f 66 66 73 65 74 20 63 |};..but |offset c|
|000003a0| 61 6e 27 74 20 62 65 20 | 73 74 61 74 69 63 61 6c |an't be |statical|
|000003b0| 6c 79 20 69 6e 69 74 69 | 61 6c 69 7a 65 64 20 77 |ly initi|alized w|
|000003c0| 69 74 68 6f 75 74 20 61 | 6e 20 6f 66 66 73 65 74 |ithout a|n offset|
|000003d0| 6f 66 20 6f 70 65 72 61 | 74 6f 72 2e 0a 28 4d 61 |of opera|tor..(Ma|
|000003e0| 67 69 63 20 6e 75 6d 62 | 65 72 73 20 61 72 65 20 |gic numb|ers are |
|000003f0| 6f 75 74 20 6f 66 20 74 | 68 65 20 71 75 65 73 74 |out of t|he quest|
|00000400| 69 6f 6e 2c 20 6f 66 20 | 63 6f 75 72 73 65 3b 20 |ion, of |course; |
|00000410| 61 6e 64 20 61 20 6d 61 | 63 72 6f 20 74 68 61 74 |and a ma|cro that|
|00000420| 0a 65 78 70 61 6e 64 73 | 20 74 6f 20 74 68 65 20 |.expands| to the |
|00000430| 64 69 66 66 65 72 65 6e | 63 65 20 62 65 74 77 65 |differen|ce betwe|
|00000440| 65 6e 20 74 77 6f 20 70 | 6f 69 6e 74 65 72 73 20 |en two p|ointers |
|00000450| 69 73 6e 27 74 20 61 20 | 63 6f 6e 73 74 61 6e 74 |isn't a |constant|
|00000460| 2e 29 0a 4d 79 20 73 65 | 63 6f 6e 64 20 74 72 79 |.).My se|cond try|
|00000470| 20 69 73 3a 0a 0a 20 20 | 20 20 74 65 6d 70 6c 61 | is:.. | templa|
|00000480| 74 65 3c 63 6c 61 73 73 | 20 54 3e 0a 20 20 20 20 |te<class| T>. |
|00000490| 73 74 72 75 63 74 20 4d | 65 6d 62 65 72 44 65 73 |struct M|emberDes|
|000004a0| 63 72 69 70 74 6f 72 0a | 20 20 20 20 7b 0a 20 20 |criptor.| {. |
|000004b0| 20 20 20 20 20 20 63 6f | 6e 73 74 20 63 68 61 72 | co|nst char|
|000004c0| 2a 20 6e 61 6d 65 3b 0a | 20 20 20 20 20 20 20 20 |* name;.| |
|000004d0| 63 68 61 72 20 54 3a 3a | 2a 20 6f 66 66 73 65 74 |char T::|* offset|
|000004e0| 3b 0a 20 20 20 20 20 20 | 20 20 73 69 7a 65 5f 74 |;. | size_t|
|000004f0| 20 73 69 7a 65 3b 0a 20 | 20 20 20 20 20 20 20 63 | size;. | c|
|00000500| 68 61 72 2a 20 47 65 74 | 53 74 72 69 6e 67 28 54 |har* Get|String(T|
|00000510| 2a 20 73 74 72 29 20 63 | 6f 6e 73 74 20 7b 20 72 |* str) c|onst { r|
|00000520| 65 74 75 72 6e 20 73 74 | 72 2d 3e 2a 6f 66 66 73 |eturn st|r->*offs|
|00000530| 65 74 3b 20 7d 0a 20 20 | 20 20 7d 3b 0a 0a 62 75 |et; }. | };..bu|
|00000540| 74 20 49 20 64 6f 6e 27 | 74 20 73 65 65 20 68 6f |t I don'|t see ho|
|00000550| 77 20 49 20 63 61 6e 20 | 77 72 69 74 65 20 74 68 |w I can |write th|
|00000560| 65 20 66 75 6e 63 74 69 | 6f 6e 20 74 68 61 74 20 |e functi|on that |
|00000570| 63 61 6c 6c 73 20 47 65 | 74 53 74 72 69 6e 67 20 |calls Ge|tString |
|00000580| 73 69 6e 63 65 0a 69 74 | 20 77 6f 6e 27 74 20 6b |since.it| won't k|
|00000590| 6e 6f 77 20 77 68 61 74 | 20 61 20 54 20 69 73 20 |now what| a T is |
|000005a0| 28 69 2e 65 2e 2c 20 69 | 74 20 6d 75 73 74 20 62 |(i.e., i|t must b|
|000005b0| 65 20 70 61 73 73 65 64 | 20 61 20 70 6f 69 6e 74 |e passed| a point|
|000005c0| 65 72 20 74 6f 20 61 0a | 4d 65 6d 62 65 72 44 65 |er to a.|MemberDe|
|000005d0| 73 63 72 69 70 74 6f 72 | 2c 20 6e 6f 74 20 61 20 |scriptor|, not a |
|000005e0| 4d 65 6d 62 65 72 44 65 | 73 63 72 69 70 74 6f 72 |MemberDe|scriptor|
|000005f0| 3c 54 3e 2c 20 6f 74 68 | 65 72 77 69 73 65 20 28 |<T>, oth|erwise (|
|00000600| 49 20 74 68 69 6e 6b 29 | 20 74 68 65 0a 66 75 6e |I think)| the.fun|
|00000610| 63 74 69 6f 6e 20 77 6f | 75 6c 64 20 68 61 76 65 |ction wo|uld have|
|00000620| 20 74 6f 20 62 65 20 61 | 20 74 65 6d 70 6c 61 74 | to be a| templat|
|00000630| 65 2c 20 74 6f 6f 2c 20 | 69 2e 65 2e 2c 20 72 65 |e, too, |i.e., re|
|00000640| 61 6c 6c 79 20 61 6e 20 | 61 72 62 69 74 72 61 72 |ally an |arbitrar|
|00000650| 69 6c 79 0a 6c 61 72 67 | 65 20 6e 75 6d 62 65 72 |ily.larg|e number|
|00000660| 20 6f 66 20 66 75 6e 63 | 74 69 6f 6e 73 29 2e 20 | of func|tions). |
|00000670| 20 41 6d 20 49 20 6d 69 | 73 73 69 6e 67 20 73 6f | Am I mi|ssing so|
|00000680| 6d 65 74 68 69 6e 67 20 | 61 62 6f 75 74 20 74 65 |mething |about te|
|00000690| 6d 70 6c 61 74 65 73 0a | 74 68 61 74 20 77 6f 75 |mplates.|that wou|
|000006a0| 6c 64 20 61 6c 6c 6f 77 | 20 74 68 69 73 20 74 6f |ld allow| this to|
|000006b0| 20 77 6f 72 6b 3f 20 20 | 49 73 20 74 68 65 72 65 | work? |Is there|
|000006c0| 20 73 6f 6d 65 20 74 68 | 69 72 64 20 74 68 69 6e | some th|ird thin|
|000006d0| 67 20 49 20 63 6f 75 6c | 64 20 74 72 79 0a 74 68 |g I coul|d try.th|
|000006e0| 61 74 20 49 20 68 61 76 | 65 6e 27 74 20 74 68 6f |at I hav|en't tho|
|000006f0| 75 67 68 74 20 6f 66 3f | 0a 0a 54 68 61 6e 6b 73 |ught of?|..Thanks|
|00000700| 2c 0a 0a 2d 2d 42 69 6c | 6c 20 28 77 73 65 79 6d |,..--Bil|l (wseym|
|00000710| 6f 75 72 40 65 6d 61 69 | 6c 2e 75 73 70 73 2e 67 |our@emai|l.usps.g|
|00000720| 6f 76 29 0a 0a | |ov).. | |
+--------+-------------------------+-------------------------+--------+--------+